package org.jinyan.d20140410;

public class InterruptTest {

	public static void main(String[] args) throws InterruptedException {
		TestThread t1 = new TestThread();
		TestThread t2 = new TestThread();
		t1.start();
		//t2.start();
		Thread.sleep(100);
		t1.interrupt();
		//t2.interrupt();

	}

}

class TestThread extends Thread {
	int i = 0;

	@Override
	public void run() {
		while (!isInterrupted()) {
			System.err.println(getName() + "_" + i++);
//			try {
//				Thread.sleep(100);
//			} catch (InterruptedException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
		}

	}

}